package com.exam.controller;

import com.exam.dto.ActionResult;
import com.exam.po.PaperManage;
import com.exam.service.PaperService;
import com.exam.service.impl.PaperServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

/**
 * @ClassName PaperController
 * @Description TODO
 * @action luoliang
 * @Data 2021/1/14 14:46
 * @Version 1.0
 */
@RestController
@RequestMapping("/api")
public class PaperController {

    @Autowired
    private PaperService paperService;

    /**
     * 添加
     * @param paperManage
     * @return
     */
    @RequestMapping(value = "/paperManage",method = RequestMethod.POST)
    public ActionResult AddPaper(@RequestBody PaperManage paperManage){
        int insert = paperService.insert(paperManage);
        if (insert>0){

            ActionResult success = new ActionResult(200, "success", insert);
            return success;
        }else {
            ActionResult error = new ActionResult(203, "error", null);
            return error;
        }
    }
}
